#include "./instance.h"
#include "./solution.h"
#include "./error.h"
#include <stdio.h>
#include <stdlib.h>

void readInstance(char *filename){
	FILE *f;
	int M, i, j, c, k;
	(f = fopen(filename, "rb")) || die("cannot open file");	
	fscanf(f, "%d %d\n", &N, &M);
	(instance = (int**)malloc(N*sizeof(int*))) || die("cannot allocate memory");
	for (i=0;i<N;i++)
		(instance[i] = (int*)malloc((i+1)*sizeof(int))) || die("cannot allocate memory");
	for (i=0;i<N;i++)
		for (j=i;j<N;j++)
			instance[i][j]=0;
	for(k=0;k<M;k++){
		fscanf(f, "%d %d %d\n", &i, &j, &c);
		instance[i][j]=c;
	}	
	fclose(f);
}

